
$(function(){
	$('#select_all_user').on('click',function(){
		if($(this).is(":checked")){
			//全选
			var inpytes = $('.td_check_u input');
			$.each(inpytes,function(){
				$(this).prop("checked", true);  
				
			});
			//$("table input:checked")
		}else{
			// 全不选
			var inpytes = $('.td_check_u input');
			$.each(inpytes,function(){
				$(this).prop("checked", false);  
				
			});
		}
		
	});
	
	
	$('#select_all_info').on('click',function(){
		if($(this).is(":checked")){
			//全选
			var inpytes = $('.td_check_info input');
			$.each(inpytes,function(){
				$(this).prop("checked", true);  
				
			});
			//$("table input:checked")
		}else{
			// 全不选
			var inpytes = $('.td_check_info input');
			$.each(inpytes,function(){
				$(this).prop("checked", false);  
				
			});
		}
		
	});
});

function lockUser(path){
	var ids = [];
	var allCheckBoxs = $('.td_check_u input:checked');
	$.each(allCheckBoxs,function(){
		var id = $(this).val();
		ids.push(id);
	});

	if(ids.length == 0){
		alert("请选择要冻结的用户");
		return false;
	}
	//冻结操作
	var url = path+"/adminstrotor/lockUser";
	var action = {'ids':ids.join(',')};
	var result = ajaxWithServer(url,action);
	if(result.result){
		if(result.data.lockResult=='SUCCESS'){
//			window.location.reload();
			window.location.href=path+"/adminstrotor/adminstrotorHome?currentTab=1";
		}else{
			alert(result.data.errorMsg);
		}
	}else{
		alert("您还没有登陆，或者您没有权限!");
	}
}

function unLockUser(path){
	var ids = [];
	var allCheckBoxs = $('.td_check_u input:checked');
	$.each(allCheckBoxs,function(){
		var id = $(this).val();
		ids.push(id);
	});
	
	if(ids.length == 0){
		alert("请选择要解冻的用户");
		return false;
	}
	//冻结操作
	var url = path+"/adminstrotor/unLockUser";
	var action = {'ids':ids.join(',')};
	var result = ajaxWithServer(url,action);
	if(result.result){
		if(result.data.unLockResult=='SUCCESS'){
//			window.location.reload();
			window.location.href=path+"/adminstrotor/adminstrotorHome?currentTab=1";
		}else{
			alert(result.data.errorMsg);
		}
	}else{
		alert("您还没有登陆，或者您没有权限!");
	}
}

function releaseInfo(path){
	$('#myModal').modal('toggle');
}

function deleteInfo(path){
	var ids = [];
	var allCheckBoxs = $('.td_check_info input:checked');
	$.each(allCheckBoxs,function(){
		var id = $(this).val();
		ids.push(id);
	});
	
	if(ids.length == 0){
		alert("请选择要删除的资讯");
		return false;
	}
	//冻结操作
	var url = path+"/adminstrotor/deleteInfo";
	var action = {'ids':ids.join(',')};
	var result = ajaxWithServer(url,action);
	if(result.result){
		if(result.data.deleteResult=='SUCCESS'){
//			window.location.reload();
			window.location.href=path+"/adminstrotor/adminstrotorHome?currentTab=2";
		}else{
			alert(result.data.errorMsg);
		}
	}else{
		alert("您还没有登陆，或者您没有权限!");
	}
}